<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/6 0006
 * Time: 17:04
 */
namespace app\modules\cn\controllers;

use yii;
use app\libs\IeltsController;
use app\modules\cn\models\HotActive;

class HotActiveController extends IeltsController
{
    public $enableCsrfValidation = false;
    public $layout = 'share';

    /**
     * [actionShareActiveDetail 分享的热门活动详情]
     * @Author don
     * @Date   2021-12-15
     * @return [type]     [description]
     */
    public function actionShareDetail()
    {
        $id = Yii::$app->request->get('id');
        $data = HotActive::find()->where(['id'=>$id])->asArray()->one();
        // 真是报名人数和假报名人数count
        $data = HotActive::getSingleReservation($data);
        // 更新浏览量
        HotActive::updateAll(['viewCount' => ($data['viewCount'] + 1)], "id=$id");
        return $this->render('share', [
            'data' => $data
        ]);
    }

}